home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / text / hyper / ADtoHT2_1.lha / Source.lha / MyLib.lha / math / __divsi3.c next >
Encoding:
C/C++ Source or Header  |  1995-03-07  |  708 b   |  60 lines

  1. asm("
  2.         .globl    _div
  3.         .globl    _ldiv
  4.         .globl    ___modsi3
  5.         .globl    ___divsi3
  6.  
  7. | D1.L = D0.L % D1.L signed
  8.  
  9. ___modsi3:    moveml    sp@(4:W),d0/d1
  10.         jbsr    ___divsi4
  11.         movel    d1,d0
  12.         rts
  13.  
  14. | D0.L = D0.L / D1.L signed
  15.  
  16. _div:
  17. _ldiv:
  18. ___divsi3:    moveml    sp@(4:W),d0/d1
  19. ___divsi4:"
  20.  
  21. #if defined(amigados)
  22.  
  23. #ifndef SMALL_DATA
  24. "
  25.         movel    _UtilityBase,a0"
  26. #else
  27. "
  28.         movel    a4@(_UtilityBase:W),a0"
  29. #endif
  30. "
  31.         jmp    a0@(-150:W)"
  32.  
  33. #else
  34.  
  35. "        movel    d3,sp@-
  36.         movel    d2,sp@-
  37.         moveq    #0,d2
  38.         tstl    d0
  39.         bpls    LC5
  40.         negl    d0
  41.         addql    #1,d2
  42. LC5:        movel    d2,d3
  43.         tstl    d1
  44.         bpls    LC4
  45.         negl    d1
  46.         eoriw    #1,d3
  47. LC4:        jbsr    ___udivsi4
  48. LC3:        tstw    d2
  49.         beqs    LC2
  50.         negl    d0
  51. LC2:        tstw    d3
  52.         beqs    LC1
  53.         negl    d1
  54. LC1:        movel    sp@+,d2
  55.         movel    sp@+,d3
  56.         rts"
  57.  
  58. #endif
  59. );
  60.